﻿// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证（版本 2.0）进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动！任何基于本项目二次开发而产生的一切法律纠纷和责任，我们不承担任何责任！

using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;

namespace Sinc.ERP.Application;

/// <summary>
/// 产品信息基础输入参数
/// </summary>
public class ProductBaseInput
{
    /// <summary>
    /// 主键Id
    /// </summary>
    public virtual long? Id { get; set; }
    
    /// <summary>
    /// 产品编码
    /// </summary>
    [Required(ErrorMessage = "产品编码不能为空")]
    public virtual string Code { get; set; }
    
    /// <summary>
    /// 产品名称
    /// </summary>
    [Required(ErrorMessage = "产品名称不能为空")]
    public virtual string Name { get; set; }
    
    /// <summary>
    /// 供应商Id
    /// </summary>
    [Required(ErrorMessage = "供应商Id不能为空")]
    public virtual long? SupplierId { get; set; }
    
    /// <summary>
    /// 成本单价
    /// </summary>
    [Required(ErrorMessage = "成本单价不能为空")]
    public virtual decimal? CostPrice { get; set; }
    
    /// <summary>
    /// 销售单价
    /// </summary>
    [Required(ErrorMessage = "销售单价不能为空")]
    public virtual decimal? UnitPrice { get; set; }
    
}

/// <summary>
/// 产品信息分页查询输入参数
/// </summary>
public class PageProductInput : BasePageInput
{
    /// <summary>
    /// 产品编码
    /// </summary>
    public string Code { get; set; }
    
    /// <summary>
    /// 产品名称
    /// </summary>
    public string Name { get; set; }
    
    /// <summary>
    /// 供应商Id
    /// </summary>
    public long? SupplierId { get; set; }
    
    /// <summary>
    /// 成本单价
    /// </summary>
    public decimal? CostPrice { get; set; }
    
    /// <summary>
    /// 销售单价
    /// </summary>
    public decimal? UnitPrice { get; set; }
    
    /// <summary>
    /// 选中主键列表
    /// </summary>
     public List<long> SelectKeyList { get; set; }
}

/// <summary>
/// 产品信息增加输入参数
/// </summary>
public class AddProductInput
{
    /// <summary>
    /// 产品编码
    /// </summary>
    [Required(ErrorMessage = "产品编码不能为空")]
    [MaxLength(50, ErrorMessage = "产品编码字符长度不能超过50")]
    public string Code { get; set; }
    
    /// <summary>
    /// 产品名称
    /// </summary>
    [Required(ErrorMessage = "产品名称不能为空")]
    [MaxLength(100, ErrorMessage = "产品名称字符长度不能超过100")]
    public string Name { get; set; }
    
    /// <summary>
    /// 供应商Id
    /// </summary>
    [Required(ErrorMessage = "供应商Id不能为空")]
    public long? SupplierId { get; set; }
    
    /// <summary>
    /// 成本单价
    /// </summary>
    [Required(ErrorMessage = "成本单价不能为空")]
    public decimal? CostPrice { get; set; }
    
    /// <summary>
    /// 销售单价
    /// </summary>
    [Required(ErrorMessage = "销售单价不能为空")]
    public decimal? UnitPrice { get; set; }
    
}

/// <summary>
/// 产品信息删除输入参数
/// </summary>
public class DeleteProductInput
{
    /// <summary>
    /// 主键Id
    /// </summary>
    [Required(ErrorMessage = "主键Id不能为空")]
    public long? Id { get; set; }
    
}

/// <summary>
/// 产品信息更新输入参数
/// </summary>
public class UpdateProductInput
{
    /// <summary>
    /// 主键Id
    /// </summary>    
    [Required(ErrorMessage = "主键Id不能为空")]
    public long? Id { get; set; }
    
    /// <summary>
    /// 产品编码
    /// </summary>    
    [Required(ErrorMessage = "产品编码不能为空")]
    [MaxLength(50, ErrorMessage = "产品编码字符长度不能超过50")]
    public string Code { get; set; }
    
    /// <summary>
    /// 产品名称
    /// </summary>    
    [Required(ErrorMessage = "产品名称不能为空")]
    [MaxLength(100, ErrorMessage = "产品名称字符长度不能超过100")]
    public string Name { get; set; }
    
    /// <summary>
    /// 供应商Id
    /// </summary>    
    [Required(ErrorMessage = "供应商Id不能为空")]
    public long? SupplierId { get; set; }
    
    /// <summary>
    /// 成本单价
    /// </summary>    
    [Required(ErrorMessage = "成本单价不能为空")]
    public decimal? CostPrice { get; set; }
    
    /// <summary>
    /// 销售单价
    /// </summary>    
    [Required(ErrorMessage = "销售单价不能为空")]
    public decimal? UnitPrice { get; set; }
    
}

/// <summary>
/// 产品信息主键查询输入参数
/// </summary>
public class QueryByIdProductInput : DeleteProductInput
{
}

/// <summary>
/// 产品信息数据导入实体
/// </summary>
[ExcelImporter(SheetIndex = 1, IsOnlyErrorRows = true)]
public class ImportProductInput : BaseImportInput
{
    /// <summary>
    /// 产品编码
    /// </summary>
    [ImporterHeader(Name = "*产品编码")]
    [ExporterHeader("*产品编码", Format = "", Width = 25, IsBold = true)]
    public string Code { get; set; }
    
    /// <summary>
    /// 产品名称
    /// </summary>
    [ImporterHeader(Name = "*产品名称")]
    [ExporterHeader("*产品名称", Format = "", Width = 25, IsBold = true)]
    public string Name { get; set; }

    [ImporterHeader(IsIgnore = true)]
    [ExporterHeader(IsIgnore = true)]
    public long? SupplierId { get; set; }
    
    /// <summary>
    /// 供应商Id
    /// </summary>
    [ImporterHeader(Name = "*供应商")]
    [ExporterHeader("*供应商", Format = "", Width = 25, IsBold = true)]
    public string SupplierName { get; set; }
    
    /// <summary>
    /// 成本单价
    /// </summary>
    [ImporterHeader(Name = "*成本单价")]
    [ExporterHeader("*成本单价", Format = "", Width = 25, IsBold = true)]
    public decimal? CostPrice { get; set; }
    
    /// <summary>
    /// 销售单价
    /// </summary>
    [ImporterHeader(Name = "*销售单价")]
    [ExporterHeader("*销售单价", Format = "", Width = 25, IsBold = true)]
    public decimal? UnitPrice { get; set; }
    
}
